#!/bin/bash
set -euo pipefail

if [[ $# -eq 0 ]] ; then
  echo 'A Semantic Versioning option of `major` `minor` or `patch` is required'
  exit 1
fi

npm run build
git add -A
git commit || true
npm version $1
git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)
git push --tags
